<?php
/*
Template Name: Check Visa Status template
 */
?>
<?php get_header(); ?>
<?php get_sidebar(); ?>
<div id="col3">
	<div class="clearfix" id="col3_content">          
		<div id="main_content">
			<div id="main_content_foot">
			<?php
				 include 'checkinput.php';
				 if($_POST['btnSubmitCheckVisa']){
				 	$email = $_REQUEST['primaryemail'];
				 	$reemail = $_REQUEST['reemail'];
				 	$secondemail = $_REQUEST['secondaryemail'];
				 	$fullname = $_REQUEST['fullname'];
				 	$passport = $_REQUEST['passport'];
				 	$request = $_REQUEST['request'];
				 	$flag = 1;
				 	$flagemail = vailemail($email);
				 	$flagreemail = vailemail($reemail);
				 	$flagfullname = vailname($fullname);
				 	$flagpassport = ($passport == "" ? -1 : 1);
				 	
				 	if(!($email == $reemail)){
						$flagreemail = -1;
					}
					$flag=($flagfullname>-1)&&($flagemail>-1)&&($flagreemail>-1)&&($flagpassport>-1);
					 
				 }
			
				if($_POST['btnSubmitCheckVisa']){
					  if($flag>0){
					  		$to=$email;
					  		$subject = "Check visa status";
					  		$message = "Dear ". $fullname.",</br>
	
							Thanks for contacting us to check your visa status.</br>
							
							Our live agent will check your visa status then inform you via email shortly.</br>
							
							Please double check to make sure your name & passport number correctly to check status.</br>
							
							INFORMATION</br>
							
							Fullname as in passport: ".$fullname."</br>
							Passport number : ".$passport."</br>
							Primary email : ".$email."</br>
							Secondary email : ".$secondemail."</br>
							Give us a message: ".$request."</br>
							Regards,</br>
							Visa-Vietnam.ORG";
					  		
					  		$from = "tram.le@codespot.vn";
					  		$headers = "From:" . $from;
					  		if (mail($to,$subject,$message,$headers) ){
					  			echo "submit successfull";	
					  		}
					  		else{
					  			echo "<script type='text/javascript'>alert(\" mail() Failure! \");</script>";
					  		}					  							  							  							  		
						 }
					else {
							 	
			?>
				<div class="contentpaneopen">
					<div id="application">
						<div id="app_form">
							<h2><span id="app_form_title">Check your visa status ?</span></h2>
							<div class="app_form_font">Please fill the form online to check your visa status with our live agent via email or email to info@visa-vietnam.org if you want to make sure your request will come to us. We will reply you shortly via email.</div>
							<div id="app_form_text1">
								<em><strong>Why you cannot check online with us</strong></em>
								Due to protecting your personal data &amp; your confidential with us, we not store your data on our website. No one can guarantee 100% that a website is unhackable &amp; of course we not guarantee 100% that our site is unhackable. Therefore, to protect your privacy, please contact us via email info@visa-vietnam.org or fill the form online as below to check your visa status with our live person.
							</div><!-- #app_form_text1 -->
							<div class="app_form_inner">
								<form action="" id="fromApp1" method="post" name="frmAppl" >
									<input type="hidden" value="1" name="confirmed" />
									<input type="hidden" value="2" name="step" />
									                                                           
                                    <label class="">Primary Email <span style="color:#FF0000">*</span></label>
                                    <input type="text" class="" value="" name="primaryemail" id="primaryemail" />
                                    <label class="">Re-Type Primary Email <span style="color:#FF0000">*</span></label>
                                    <input type="text" class="" autocomplete="off" onpaste="alert('You cannot directly copy and paste.');this.value='';return false;" value="" name="reemail" id="reemail" />  
                                    <label>Secondary Email (optional)</label>
                                    <input type="text" value="" id="secondaryemail" name="secondaryemail" />            
                                    <label class="">Fullname (as in passport) <span style="color:#FF0000">*</span></label>
                                    <input type="text" class="" value="" id="fullname" name="fullname" />
                                    <label>Passport Number <span style="color:#FF0000">*</span></label>      
                                    <input type="text" class="" value="" id="passport" name="passport" />         
                                               
                                    <label class="lamessage">Give us a message</label>       
                                    <textarea id="request" name="request"></textarea>
                                    <div class="submit_form1">
                                    	<input type="submit" onclick="submitForm(1);" value="Submit &gt;&gt;" name="btnSubmitCheckVisa" class="button">
                                    </div><!-- #submit_form1 -->
								</form>
							</div><!-- #app_form_inner -->
						</div><!-- #app_form -->
						<div id="urgent_frame">
	
							<em><strong>Why we don't accept call for your visa?</strong></em>
							
							Getting visa to enter a country is very important and you will lose much money if problem with your visa. We don't want any problem with your visa therefore we would like your visa request must be confirmed via email to make sure we all understand correctly regarding your visa request &amp; we will responsible for what we confirm you via email.
							
							Don't worry if you want to get your visa on Sat or Sun or Public holiday. We know how.
							
							Best regards,
							<strong>Visa-Vietnam.Org</strong>
						
						</div><!-- #urgent_frame -->
					</div><!-- #application -->
				</div><!-- #contentpaneopen -->
				
			<?php
						$view = "";
					 	if($flagemail == -1){
					 		$view .= "primaryemail is empty.";
					 	}
					 	else if($flagemail == -2){
					 		?>
					 	<script type='text/javascript'>alert("<?php echo "Primary email and re-typed email does not match."; ?>");</script><?php	
					 	}					 		
					 	if($flagreemail == -1){
					 		$view .= "reemail is empty.";
					 	}
					 	if($flagfullname<=-1){
					 		$view .= "fullname is empty.";
					 	}
					 	if($flagpassport <= -1){
					 		$view .= "passport is empty.";
					 	}
					 	echo "<script type='text/javascript'>alert(\"".$view."\");</script>";					 	 	
					}
				} 
				else{
			?>
				<div class="contentpaneopen">
					<div id="application">
						<div id="app_form">
							<h2><span id="app_form_title">Check your visa status ?</span></h2>
							<div class="app_form_font">Please fill the form online to check your visa status with our live agent via email or email to info@visa-vietnam.org if you want to make sure your request will come to us. We will reply you shortly via email.</div>
							<div id="app_form_text1">
								<em><strong>Why you cannot check online with us</strong></em>
								Due to protecting your personal data &amp; your confidential with us, we not store your data on our website. No one can guarantee 100% that a website is unhackable &amp; of course we not guarantee 100% that our site is unhackable. Therefore, to protect your privacy, please contact us via email info@visa-vietnam.org or fill the form online as below to check your visa status with our live person.
							</div><!-- #app_form_text1 -->
							<div class="app_form_inner">
								<form action="" id="fromApp1" method="post" name="frmAppl" >
									<input type="hidden" value="1" name="confirmed" />
									<input type="hidden" value="2" name="step" />
									                                                           
                                    <label class="">Primary Email <span style="color:#FF0000">*</span></label>
                                    <input type="text" class="" value="" name="primaryemail" id="primaryemail" />
                                    <label class="">Re-Type Primary Email <span style="color:#FF0000">*</span></label>
                                    <input type="text" class="" autocomplete="off" onpaste="alert('You cannot directly copy and paste.');this.value='';return false;" value="" name="reemail" id="reemail" />  
                                    <label>Secondary Email (optional)</label>
                                    <input type="text" value="" id="secondaryemail" name="secondaryemail" />            
                                    <label class="">Fullname (as in passport) <span style="color:#FF0000">*</span></label>
                                    <input type="text" class="" value="" id="fullname" name="fullname" />
                                    <label>Passport Number <span style="color:#FF0000">*</span></label>      
                                    <input type="text" class="" value="" id="passport" name="passport" />         
                                               
                                    <label class="lamessage">Give us a message</label>       
                                    <textarea id="request" name="request"></textarea>
                                    <div class="submit_form1">
                                    	<input type="submit" onclick="submitForm(1);" value="Submit &gt;&gt;" name="btnSubmitCheckVisa" class="button">
                                    </div><!-- #submit_form1 -->
								</form>
							</div><!-- #app_form_inner -->
						</div><!-- #app_form -->
						<div id="urgent_frame">
	
							<em><strong>Why we don't accept call for your visa?</strong></em>
							
							Getting visa to enter a country is very important and you will lose much money if problem with your visa. We don't want any problem with your visa therefore we would like your visa request must be confirmed via email to make sure we all understand correctly regarding your visa request &amp; we will responsible for what we confirm you via email.
							
							Don't worry if you want to get your visa on Sat or Sun or Public holiday. We know how.
							
							Best regards,
							<strong>Visa-Vietnam.Org</strong>
						
						</div><!-- #urgent_frame -->
					</div><!-- #application -->
				</div><!-- #contentpaneopen -->
				
			<?php }?>
			</div><!-- #main_content_foot -->					
		</div><!-- #main_content -->
<?php get_footer(); ?>